

#include <stdio.h>
#include <sys/time.h>

unsigned long long get_system_time()
{
    struct timeval tv;
    if (gettimeofday(&tv, NULL) < 0)
    {
        return -1;
    }
    return (unsigned long long)tv.tv_sec * 1000000 + tv.tv_usec;
}

int main()
{
    unsigned long long time_microsec = 0;
    time_microsec = get_system_time();
    if (time_microsec != -1)
    {
        printf("System time: %llu microseconds\n", time_microsec);
    }
    else
    {
        printf("Failed to get system time\n");
    }
    return 0;
}